<script>
var _siteUrl = '<?php echo  Yii::app()->params['siteUrl']?>admincp/';
</script>

<?php
/* @var $this TransferController */
/* @var $dataProvider CActiveDataProvider */
Yii::app()->clientScript->registerScriptFile(Yii::app()->baseUrl . "/global/js/pages/adminTransfer.js");
$this->breadcrumbs=array(
	'Transfers',
);

$this->menu=array(
	array('label'=>'Create Transfer', 'url'=>array('create')),
	array('label'=>'Manage Transfer', 'url'=>array('admin')),
);
?>

<?php
$udArray = array();
$udArray[0] = '请选择';
foreach($ud as $v) {
	$udArray[$v->id] = str_repeat('  ',$v->level). $v->name;	
}

?>

<div style="padding:3px;">
    <table class="s_table" style="width:96%" >
        <tr>
            <td width="100" align="right" >调动元素：</td>
            <td align="left"><input name="" value="<?php echo $search['s_username'];?>" id="s_username" class="small_input"  /></td>
        </tr>
        <tr>
            <td align="right">状态：</td>
            <td align="left">
            <?php  echo CHtml::dropDownList('s_status' ,$_GET['search']['s_status'] ,$statusName ,array('onchange'=>'transfer.getUsersByDepartment()','class'=>'mid_select2')); ?>
            </td>
        </tr>
        <tr>
            <td align="right">原部门：</td>
            <td align="left">
            <?php  echo CHtml::dropDownList('s_o_d' , $_GET['search']['s_o_d'] ,$udArray ,array('onchange'=>'transfer.getUsersByDepartment()','class'=>'mid_select2')); ?>
            </td>
        </tr>
        <tr>
            <td align="right">新部门：</td>
            <td align="left">
            <?php  echo CHtml::dropDownList('s_n_d' ,$_GET['search']['s_n_d'] ,$udArray ,array('onchange'=>'transfer.getUsersByDepartment()','class'=>'mid_select2')); ?>
            </td>
        </tr>
        <tr>
            <td align="right"> 生效时间：</td>
            <td align="left">
            <?php
            $this->widget('zii.widgets.jui.CJuiDatePicker', array(
                'name'=>'s_t_start',
                'id'=>'s_t_start',
                'value'=>$_GET['search']['s_t_start'],
                // additional javascript options for the date picker plugin
                'options'=>array(
                    'showAnim'=>'fold',
                ),
                'htmlOptions'=>array(
                    'class'=>'small_input' 
                ),
            ));
            ?>
            -
            <?php
            $this->widget('zii.widgets.jui.CJuiDatePicker', array(
                'name'=>'s_t_end',
                'id'=>'s_t_end',
                'value'=>$_GET['search']['s_t_end'],
                // additional javascript options for the date picker plugin
                'options'=>array(
                    'showAnim'=>'fold',
                ),
                'htmlOptions'=>array(
                    'class'=>'small_input'
                ),
            ));
            ?>
            </td>
        </tr>
        <tr>
            <td>
            
            </td>
            <td align="left" colspan="2"> <input type="button"  value="Search" class="c_button" id="search_transfer" /> <input type="button"  value="Export" class="c_button" id="export_transfer" /> </td>
        </tr>
    </table>
</div>


<?php
$this->widget('zii.widgets.grid.CGridView', array(
    'id'=>'transfer-grid',
    'dataProvider'=>$dataProvider,
	'summaryText'=>'<font color=#0066A4>显示{start}-{end}条.共{count}条记录,当前第{page}页</font>',
   // 'filter'=>$model,
	'columns'=>array( 
		array(
			'name'=>'id',
			'sortable' => true,
		),
		'transfer_c_usernames',
		'from_department_name',
		'to_department_name',
		array(
			'name' => 'status',
			'value'=> 'Transfer::getStatusName($data->status)',
		),
		array(
			 'name'=>'effective_time',
             'value'=>'date("Y-m-d H:i", $data->effective_time)',
		),
		array(            // display 'create_time' using an expression
            'name'=>'create_time',
            'value'=>'date("Y-m-d H:i", $data->create_time)',
        ),
		'start_c_username',
		array(            // display a column with "view", "update" and "delete" buttons
            'class'=>'CButtonColumn',
			'template'=>'{detail}{edit}',
			'buttons'=>array(
                    'detail' => array(
                            'label'=>'查看',     // text label of the button
                            'url'=>'Yii::app()->controller->createUrl("transfer/detail",array("id"=>$data->primaryKey))',       // a PHP expression for generating the URL of the button
                            'imageUrl'=>Yii::app()->request->baseUrl.'/global/img/icons/magnifier.png',  // image URL of the button. If not set or false, a text link is used
                            'options'=>array('style'=>'cursor:pointer;', "target" => "_blank"), // HTML options for the button tag
                            'visible'=>'true',
                    ),
					'edit' => array(
                            'label'=>'编辑',     // text label of the button
                            'url'=>'Yii::app()->controller->createUrl("transfer/edit",array("id"=>$data->primaryKey))',       // a PHP expression for generating the URL of the button
                            'imageUrl'=>Yii::app()->request->baseUrl.'/global/img/icons/page_white_edit.png',  // image URL of the button. If not set or false, a text link is used
                            'options'=>array('style'=>'cursor:pointer;'), // HTML options for the button tag
                            'visible'=>'true',
                    ),
            ),
			
        ),
		
		
		
	), 
		
));
?>